#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <stdbool.h> 
bool isUnivalTree(struct TreeNode* root) {
	if (root == NULL)
		return true;
	if (root->left && root->left->val != root->val)
		return false;
	if (root->right && root->right->val != root->val)
		return false;
	return isUnivalTree(root->left) && isUnivalTree(root->right);
}

bool isSameTree(struct TreeNode* p, struct TreeNode* q) {
	if(!p && !q)
		return	true;
	if(!p || !q)
		return false;
	if (p->val != q->val)
		return false;
	return  isSameTree(p->left, q->left) && isSameTree(p->right, q->right);
}